<template>
  <div id="app" :class="{greeTheme: isMemorialDay}">
    <keep-alive>
       <router-view v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>
    <!--// 不缓存的页面-->
    <router-view v-if="!$route.meta.keepAlive"></router-view>
  </div>
</template>

<script>
export default {
  name: 'App',
  created () {
    let name = this.$route.name
    if (name !== 'login' && name !== 'reg' && name !== 'welcome') {
      let userId = localStorage.getItem('userId') // 保存用户id
      if (!userId) {
        this.$toast('请先登录', 'loading', 2000)
        setTimeout(() => {
          this.toNewPage('/login')
        }, 1200)
      }
    }
  },
  computed: {
    isMemorialDay () {
      const now = new Date().toISOString()
      console.log(now.split('T')[0], 'now')
      return now.split('T')[0].includes('12-13')
    }
  }
}
</script>

<style lang="stylus">
$color = #ff74a3
.greeTheme {
  filter: grayscale(100%)
}
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  font-size:12px;
  color: #2c3e50;
  overflow-x: hidden;
}
  .main-color
  {
    color:deeppink!important
  }
  .gray-color
  {
    color: #f0f0f0!important
  }
    //浅色投影
  .box-shadow
  {
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)
  }
</style>
